<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="usuario_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('criarAcesso.xhtml')}" value="Usuário" update="@form" immediate="true"/> >
                    <p:commandLink  value="Cadastrar Usuário" update="@form" immediate="true"/>
                </div>
                <p:panel header="Cadastrar Usuário">
                    <p:messages id="msg"/>
                    <fieldset>
                        <legend>Dados do Usuário</legend>
                        <h:panelGrid columns="2"  border="0" id="dadosUsr"
                                     styleClass="textAlignRight" columnClasses="textAlignRight"> 
                            <h:outputLabel value="Nome: "/>
                            <p:inputText value="#{managerUsuario.usuario.nome}"
                                         id="nome_user"
                                         required="true" size="50" 
                                         requiredMessage="O campo nome deve ser preenchido "/>


                            <h:outputLabel value="Cpf:"/>  
                            <p:inputMask value="#{managerUsuario.usuario.cpf}" 
                                         id="cpf_user" mask="999.999.999-99"   maxlength="11" style="width: 165px"/> 
                            <h:outputLabel value="Rg:"/>  
                            <p:inputText value="#{managerUsuario.usuario.rg}" 
                                         id="rg_user" maxlength="11" style="width: 165px"/>
                            <h:outputLabel value=" Sexo: " />  
                            <p:selectOneRadio id="sexo" value="#{managerUsuario.usuario.sexo}"  
                                              label="Sexo">  
                                <f:selectItems value="#{managerUsuario.selectItemSexo()}"/>                     
                            </p:selectOneRadio>
                            <h:outputLabel value="Telefone:"/>  
                            <p:inputMask value="#{managerUsuario.usuario.contato}" 
                                         id="contato_user" mask="99-9999-9999"   maxlength="11" style="width: 165px"/> 
                            <h:outputLabel value="Email:"/>  
                            <p:inputText value="#{managerUsuario.usuario.email}" 
                                         id="email_user" required="true" requiredMessage="O campo email deve ser preenchido" 
                                         maxlength="100" size="50"/> 
                        </h:panelGrid>

                    </fieldset>
                    <br/>
                    <br/>
                    <fieldset>
                        <legend>Dados de Login</legend>
                        <h:panelGrid columns="2"  border="0" id="dadosLogin"
                                     styleClass="textAlignRight" columnClasses="textAlignRight">  
                            <h:outputLabel value="Login: "/>
                            <p:inputText value="#{managerUsuario.usuario.login}"
                                         required="true" size="20" 
                                         requiredMessage="O campo login deve ser preenchido " />
                            <h:outputLabel value="Senha: "/>
                            <p:password value="#{managerUsuario.usuario.senha}"
                                        required="true" size="20" 
                                        requiredMessage="O campo senha deve ser preenchido " feedback="true"/>
                            <h:outputLabel value="Confirmar: "/>
                            <p:password value="#{managerUsuario.confirmaSenha}"
                                        required="true" size="20" 
                                        requiredMessage="O campo confirmar deve ser preenchido " feedback="true"/>
                        </h:panelGrid>
                    </fieldset>
                    <br/>
                    <br/>
                   <fieldset>
                        <legend>Informações ao Sistema</legend>
                        <h:panelGrid columns="2" id="dadosAP"  border="0"  styleClass="textAlignRight" columnClasses="textAlignRight">
                            <h:outputLabel value="Atividade Profissional:"/>
                            <p:inputText value="#{managerUsuario.usuario.cargo}" size="50"/>
                        </h:panelGrid>
                            <p:pickList id="picklistGrupos"  style="margin-top: 10px"
                                        
                                        value="#{managerUsuario.dualGrupo}" var="grupo"
                                        itemLabel="#{grupo.descricao}" converter="grupoConverter" itemValue="#{grupo}">
                                        <f:facet name="sourceCaption">Grupo</f:facet>	
                                        <f:facet name="targetCaption">Grupo Selecionados</f:facet>
                            </p:pickList>
                    </fieldset>
                    <div class="buttonAction">
                        <p:commandButton id="id_submit"  icon="ui-icon-disk" value="Salvar"
                                         actionListener="#{managerUsuario.salvar()}" 
                                         update="msg, dadosUsr, dadosAP, dadosLogin" process="@form"/>
                        <p:commandButton icon="ui-icon-arrowreturnthick-1-w" value="Cancelar"
                                         actionListener="#{managerVisualizarUsuario.redirect('criarAcesso.xhtml') }" immediate="true" />
                    </div>
                </p:panel>   
                <p:blockUI block="id_submit" trigger="id_submit">  
                    CARREGANDO...<br />  
                    <p:graphicImage value="/media/img/ajax-loader.gif"/>  
                </p:blockUI>



            </h:form>  

        </ui:define>


    </ui:composition> 

</html>